package com.yjzx.util.common.util.excel.alibaba;

import java.util.Arrays;
import java.util.List;

/**
 * @author guozhi
 * @date 2024/9/10
 * @description SkipExcelListenerBuilder
 */
class SkipExcelListenerBuilder implements ExcelListenerInterface{
    private int skipRowStart = -1;
    private int skipRowEnd = Integer.MAX_VALUE;
    private List<List<String>> head;
    SkipExcelListenerBuilder() {
    }

    @Override
    @SafeVarargs
    public final SkipExcelListenerBuilder withHead(List<String>... heads) {
        this.head = Arrays.asList(heads);
        return this;
    }

    @Override
    public SkipExcelListenerBuilder withHead(List<List<String>> heads) {
        this.head = heads;
        return this;
    }
    @Override
    public SkipExcelListenerBuilder withHead(Class<?> head) {
        this.head = ExcelListener.classToExcelHead(head);
        return this;
    }

    @Override
    public SkipExcelListenerBuilder withSkipRowStart(int skipRowStart) {
        this.skipRowStart = skipRowStart;
        return this;
    }

    @Override
    public SkipExcelListenerBuilder withSkipRowEnd(int skipRowEnd) {
        this.skipRowEnd = skipRowEnd;
        return this;
    }
    @Override
    public <T>SkipExcelListener<T> build() {
        return new SkipExcelListener<>(this.head, this.skipRowStart, this.skipRowEnd);
    }
}
